package com.ear.orange.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ear.orange.entity.ShoppingCart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author orange
 */
@Mapper
public interface ShoppingCardMapper extends BaseMapper<ShoppingCart> {
    /**
     * 添加
     *
     * @param shoppingCart
     */
    void addProduct(ShoppingCart shoppingCart);

    /**
     * 查询
     *
     * @param userId
     * @return
     */
    List<ShoppingCart> listProducts(@Param("userId") Long userId);

    /**
     * 清空
     *
     * @param userId
     * @param dishId
     * @param setmealId
     */
    void cleanProducts(@Param("userId") Long userId, @Param("dishId") Long dishId, @Param("setmealId") Long setmealId);

    /**
     * 查询购物车
     *
     * @param shoppingCart
     * @return
     */
    ShoppingCart selProduct(ShoppingCart shoppingCart);

    /**
     * 修改数量
     *
     * @param shoppingCart
     */
    void updateProduct(ShoppingCart shoppingCart);
}
